Dynamic protocols switching#113
Open
edmont wants to merge 5 commits into
Open
Conversation
Add an atomic flag set while top-level BDB commissioning runs so coexistence can block protocol switches during join without treating idle unjoined devices as always pairing. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Wire coexistence button handling on the light switch and light bulb combined samples. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Let combined builds choose Zigbee or Matter as the initial protocol when no persisted settings entry exists yet. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Make CHIPoBLE during the Zigbee phase, user button switching, and hold time independently configurable. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
There was a problem hiding this comment.
Pull request overview
This PR extends the Zigbee+Matter coexistence runtime to support user-triggered protocol switching (via long button press) and adds configuration options for (a) choosing the default protocol on factory-fresh boot and (b) optionally avoiding Matter BLE commissioning advertisement while Zigbee is active.
Changes:
- Add Kconfig-controlled default protocol selection on first boot (before any persisted state exists).
- Add coexistence options and APIs for long-press protocol switching and for gating the “Matter ready” signal (BLE-advertising event vs explicit app signal).
- Track “Zigbee commissioning/join active” state to block protocol switching during commissioning operations.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| subsys/lib/zigbee_matter_protocol_state/matter_protocol_state.c | Applies a configurable default protocol when no persisted state is present. |
| subsys/lib/zigbee_matter_protocol_state/Kconfig | Adds a choice for selecting the default protocol on first boot. |
| subsys/lib/zigbee_matter_coexistence/Kconfig | Adds options for BLE commissioning while Zigbee is active and for button-based protocol switching. |
| subsys/lib/zigbee_matter_coexistence/coexistence.cpp | Implements long-press switch handling, Zigbee reboot switch path, and “Matter init done” signaling. |
| subsys/lib/zigbee_app_utils/zigbee_app_utils.c | Introduces a global commissioning-active flag and integrates it into commissioning/rejoin flows. |
| samples/light_switch/src/app_task.cpp | Signals Matter board init completion to coexistence runtime when BLE-based signaling is disabled. |
| samples/light_switch/src/app_task_zigbee.c | Adds long-press switch button handling and commissioning tracking for Touchlink initiation. |
| samples/light_switch/prj_matter_fota.conf | Enables coexistence runtime logging level in the sample config. |
| samples/light_bulb/src/app_task_zigbee.cpp | Adds long-press switch button handling for the Zigbee button callback path. |
| samples/light_bulb/src/app_task_matter.cpp | Signals Matter board init completion to coexistence runtime when BLE-based signaling is disabled. |
| samples/light_bulb/prj_matter_fota.conf | Enables coexistence runtime logging level in the sample config. |
| include/zigbee/zigbee_app_utils.h | Exposes commissioning-active query/set APIs for samples and runtime coordination. |
| include/zigbee/matter_protocol_state.h | Updates module documentation to reference configurable first-boot default behavior. |
| include/zigbee/matter_coexistence.h | Adds new coexistence APIs and updates documentation for Matter-init signaling and button switching. |
Comments suppressed due to low confidence (1)
samples/light_switch/src/app_task_zigbee.c:270
zigbee_network_join_commissioning_set_active(true)is set before starting Touchlink commissioning, but ifbdb_start_top_level_commissioning()rejects the request the flag is never restored/cleared. This can leave the global commissioning-active state stuck true.
zigbee_network_join_commissioning_set_active(true);
zigbee_touchlink_initiator_prepare_scan_channels();
if (!bdb_start_top_level_commissioning(ZB_BDB_TOUCHLINK_COMMISSIONING)) {
LOG_WRN("Touchlink commissioning rejected (already in progress?)");
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+57
to
+61
| static zb_bool_t bdb_start_commissioning_tracked(zb_uint8_t mode_mask) | ||
| { | ||
| zigbee_network_join_commissioning_set_active(true); | ||
| return bdb_start_top_level_commissioning(mode_mask); | ||
| } |
Comment on lines
+87
to
+89
| * Detects a long press on @p switch_button and requests a protocol switch | ||
| * when @kconfig_ZIGBEE_MATTER_COEXISTENCE_SWITCH_BUTTON_PRESS_TIME_SECONDS | ||
| * expires. |
Comment on lines
+1149
to
1150
| if (bdb_start_commissioning_tracked(ZB_BDB_NETWORK_STEERING) != ZB_TRUE) { | ||
| LOG_WRN("Network steering: bdb_start_top_level_commissioning rejected"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the option to switch between Matter and Zigbee (and vice-versa) on a long button press.
Also allow to disable Matter commissioning advertisement while Zigbee is running.
TODO: